<template>
    <tr >
        <td><input type="checkbox" :checked="tr.checked" @change="doing('chk', index)"></td>
        <td>{{tr.name}}</td>
        <td>{{tr.price}}</td>
        <td><button @click="doing('sub', index)">-</button>{{tr.num}}<button @click="doing('add', index)">+</button></td>
        <td>{{(tr.price * tr.num).toFixed(2)}}</td>
        <td><button @click="doing('del', index)">删除</button></td>
    </tr>
</template>

<script>
export default {
  name: 'tr-com',
  props: ['tr', 'index'],
  methods: {
    doing (type, index) {
      this.$emit('doing', type, index)
    }
  }
}
</script>

<style>

</style>
